# Contributor: Ivan Tham <pickfire@riseup.net>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer:
pkgname=ubase
pkgver=20200605
_gitrev=f152e7fc3bd1675060818ac224f96541a2d9d6e7
pkgrel=3
pkgdesc="Suckless collection of unportable base"
url="https://github.com/michaelforney/ubase"
arch="all"
license="MIT"
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
subpackages="$pkgname-doc"
source="https://github.com/michaelforney/ubase/archive/$_gitrev/ubase-$_gitrev.tar.gz
	config.patch
	setup-ubase.in
	"
builddir="$srcdir/$pkgname-$_gitrev"
options="!check"  # upstream provides no test suite

prepare() {
	default_prepare
	sed "s/@@VERSION@@/$pkgver/" "$srcdir"/setup-ubase.in > setup-ubase
}

build() {
	make ubase-box CFLAGS="$CFLAGS"
}

package() {
	make ubase-box-install DESTDIR="$pkgdir" PREFIX=/usr MANPREFIX=/usr/share/man VERSION=$pkgver
	find "$pkgdir"/usr/bin -type l -delete

	install -D -m755 setup-ubase -t "$pkgdir"/usr/bin/
}

sha512sums="
3e7c023048b24857267ec57d07b9f19533f8738aac1901d7b421e21e2421e4cc3d6130b3548585f21cda6a8ee99c87098a0648d72cd2f14ad2ff59bf766593bb  ubase-f152e7fc3bd1675060818ac224f96541a2d9d6e7.tar.gz
5b944c737e77f144651e48e5221057b714e14811707f2fc17bfc336c4d32c4792e449e9cbb42d7e2f02c36438721045d961c34b01cf5b342e9e3ed2914d2bcb2  config.patch
59b3a25e85c247dd86b85990b6076708cd94316a8332665a9d8277bf2f0ace5fae549f5ef83145dd25003df2eb302a0106fbafcf9205a4a1893677b27adefceb  setup-ubase.in
"
